<%--
  Created by IntelliJ IDEA.
  User: limin
  Date: 2021/8/5
  Time: 14:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title></title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">

    <script type="text/javascript" src="js/jquery-1.8.0.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#ch_checkall,#top_ch_checkall").click(function(){
                if(this.checked){
                    $("input[name=ck_id]").attr("checked","checked");
                }else{
                    $("input[name=ck_id]").removeAttr("checked");
                }
            });

            $("table tr").mouseover(function(){
                $(this).css("background","#D3EAEF");
                $(this).siblings().css("background","white");
            });
        });
    </script>

    <link rel="stylesheet" type="text/css" href="css/maintable.css" >

</head>

<body>

<div class ="div_title">
    <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>管理人员基本信息列表</span></div>
    <div class="div_titleoper">
        <input type="checkbox" id="top_ch_checkall"/> 全选 <a href="admin_add.jsp"> <img src="images/add.gif"/>添加 </a> <a href="javascript:void(0)"><img src="images/del.gif"/>删除</a> </div>
</div>

<form action="xxx"  name="form1">

    <table class="main_table" >
        <tr>
            <th><input type="checkbox" id="ch_checkall" /></th>	<th>账号</th> 	<th>状态</th>	<th>备注</th>  <th>最后更新日期</th> 	<th>操作</th>
        </tr>
        <c:forEach var="admin" items="${adminList}">
            <tr>
                <td>
                    <input type="checkbox" name="ck_id" value="69" />
                </td>
                <td>${admin.adminName }</td>
                <td>
                    <c:if test="${admin.state == 2}">
                        锁定
                    </c:if>
                    <c:if test="${admin.state == 1}">
                        正常
                    </c:if>
                </td>
                <td> <a title="${admin.note }">${admin.note }</a> </td>

                <td>${admin.editDate }</td>
                <td>
                    <c:choose>
                        <c:when test="${admin.state ==2}">
                            <a href="AdminServlet.do?flag=unlock&id=${admin.id}&roleId=${admin.roleId}&pageIndex=${page.pageIndex}">解锁</a>
                            <a href="AdminServlet.do?flag=deleteAdmin&id=${admin.id}&roleId=${admin.roleId}&pageIndex=${page.pageIndex}" onclick="return confirm('确认删除吗')">删除</a>
                        </c:when>
                        <c:otherwise>
                            <a href="AdminServlet.do?flag=lock&id=${admin.id}&roleId=${admin.roleId}&pageIndex=${page.pageIndex}">锁定</a>
                            <a href="AdminServlet.do?flag=updateAdmin&id=${admin.id}&pageIndex=${page.pageIndex}">修改</a>
                            <a href="AdminServlet.do?flag=deleteAdmin&id=${admin.id}&roleId=${admin.roleId}&pageIndex=${page.pageIndex}" onclick="return confirm('确认删除吗')">删除</a>
                        </c:otherwise>
                    </c:choose>

                </td>
            </tr>
        </c:forEach>

    </table>
</form>

<div class="div_page" >
    <div class="div_page_left">    共有 <label>${page.rowCount }</label> 条记录，当前第 <label>${page.pageIndex }</label> 页，共 <label>${page.pageCount } 页</label> 页	</div>
    <div class="div_page_right" >
        <c:if test="${page.pageIndex != 1 }">
            <a href="AdminServlet.do?flag=getAdminList&pageIndex=1">首页</a>
            <a href="AdminServlet.do?flag=getAdminList&pageIndex=${ page.pageIndex-1 }">上一页</a>
        </c:if>
        <c:if test="${page.pageIndex != page.pageCount }">
            <a href="AdminServlet.do?flag=getAdminList&pageIndex=${ page.pageIndex+1 }">下一页</a>
            <a href="AdminServlet.do?flag=getAdminList&pageIndex=${page.pageCount }">尾页</a>
        </c:if>
        <input type=submit value="转到第" > <input name="pageIndex" value="${page.pageIndex }" > 页
    </div>

</div>
${msg}
</body>
</html>
